<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <style>
      html,
      body {
        height: 100%;
      }
      * {
        margin: 0;
        padding: 0;
      }
      canvas {
        border: 1px solid black;
        margin: 0 auto;
        display: block;
      }
    </style>
  </head>
  <body>
    <canvas width="500" height="500">浏览器版本过低</canvas>
    <script>
      // 获取画布
      const canvas = document.querySelector('canvas');
      // 获取画笔
      const c = canvas.getContext('2d');

      // 开始一条路径(默认会结束上一条路径)
      c.beginPath();
      c.arc(100, 100, 100, 0, Math.PI, true);
      c.stroke();
      // 开始一条路径(默认会结束上一条路径)
      c.beginPath();
      c.arc(300, 100, 100, 0, Math.PI, false);
      c.stroke();

      // 开始一条路径(默认会结束上一条路径)
      c.beginPath();
      c.arc(250, 250, 120, 0, Math.PI * 2, false);
      c.stroke();
      // 开始一条路径(默认会结束上一条路径)
      c.beginPath();
      c.arc(250, 250, 100, 0, Math.PI * 2, false);
      c.stroke();
      // 开始一条路径(默认会结束上一条路径)
      c.beginPath();
      c.arc(250, 250, 80, 0, Math.PI * 2, false);
      c.stroke();
    </script>
  </body>
</html>
